//引入vue
import Vue from 'vue';
//引入vue-router
import Router from 'vue-router';
import login from "./login/login"
import home from "./home/platform/PlatList"
import orglist from "./system/Org/OrgList"
import opelist from "./system/Ope/OpeList"
import userList from "./user/UserList"
import roleList from "./role/RoleList"
const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
//第三方库需要use一下才能用
Vue.use(Router)

//定义routes路由的集合，数组类型
const routes = [
	//单个路由均为对象类型，path代表的是路径，component代表组件
	{
		path: '/',
		component: login
	},
	{
		path: '',
		component: login
	},
	{
		path: '/login',
		component: login
	},
	{
		path: "/home",
		component: home,
		children: [{
				path: 'userList',
				component: userList,
				meta: {
					title: "微简通用企业管理"
				}
			},
			{
				path: 'roleList',
				component: roleList
			},
			{
				path: 'orglist',
				component: orglist
			},
			{
				path: 'opelist',
				component: opelist
			}
		]
	}
]

//实例化VueRouter并将routes添加进去
const router = new Router({
	mode: 'history',
	routes
});

//抛出这个这个实例对象方便外部读取以及访问
export default router
